<?php

/**
 * dingo api助手函数
 * @param bool $success
 * @param string $msg
 * @param array $data
 * @param int $code
 * @param string $status
 * @return mixed
 */
function message($success = true, $msg = '', $data = [], $code = 0, $status = '200'){
    $array =  [
        'success'   =>  $success,
        'code'      =>  $code,
        'msg'       =>  $msg,
        'data'      =>  $data,
        'status'    =>  $status
    ];

    $response = app(\Dingo\Api\Http\Response\Factory::class);
    return $response->array($array)->setStatusCode($status);

}